package com.zulu.karaoke.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.zulu.karaoke.R;

public class ListFavouriteAdapter extends ArrayAdapter<String>{

	private final Context context;
	private final String[] lstNumber;
	private final String[] lstTitle;
	
	public ListFavouriteAdapter(Context context, String[] lstNumber, String[] lstTitle) {
		super(context, R.layout.list_view_favourite_song, lstNumber);
		this.context = context;
		this.lstNumber = lstNumber;
		this.lstTitle = lstTitle;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		
		View rowView = inflater.inflate(R.layout.list_view_favourite_song, parent, false);
		TextView tvNumber = (TextView) rowView.findViewById(R.id.tv_favourite_number);
		TextView tvTitle = (TextView) rowView.findViewById(R.id.tv_favourite_title);
		
		tvNumber.setText(lstNumber[position]);
		tvTitle.setText(lstTitle[position]);
		
		return rowView;
	}
	
}
